package com.ruoyi.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.system.domain.SysDealerInfo;
import com.ruoyi.system.service.ISysDealerInfoService;

/**
 * 经销商信息 提供者
 * 
 * @author ruoyi
 * @date 2021-09-17
 */
@Api(value = "经销商信息")
@RestController
@RequestMapping("sysDealerInfo")
public class SysDealerInfoController extends BaseController
{
	
	@Autowired
	private ISysDealerInfoService sysDealerInfoService;
	
	/**
	 * 查询${tableComment}
	 */
	@ApiOperation(value = "根据id查询")
	@ApiImplicitParam(name = "id", value = "id", required = true)
	@GetMapping("get/{id}")
	public SysDealerInfo get(@PathVariable("id") Long id)
	{
		return sysDealerInfoService.selectSysDealerInfoById(id);
		
	}
	
	/**
	 * 查询经销商信息列表
	 */
	@ApiOperation(value = "查询经销商信息列表及根据条件查询列表")
	@GetMapping("list")
	public R list(SysDealerInfo sysDealerInfo)
	{
		startPage();
        return result(sysDealerInfoService.selectSysDealerInfoList(sysDealerInfo));
	}
	
	
	/**
	 * 新增保存经销商信息
	 */
	@ApiOperation(value = "新增保存经销商信息")
	@PostMapping("save")
	public R addSave(@RequestBody SysDealerInfo sysDealerInfo)
	{		
		return toAjax(sysDealerInfoService.insertSysDealerInfo(sysDealerInfo));
	}

	/**
	 * 修改保存经销商信息
	 */
	@ApiOperation(value = "修改保存经销商信息")
	@PostMapping("update")
	public R editSave(@RequestBody SysDealerInfo sysDealerInfo)
	{		
		return toAjax(sysDealerInfoService.updateSysDealerInfo(sysDealerInfo));
	}
	
	/**
	 * 删除${tableComment}
	 */
	@ApiOperation(value = "删除")
	@ApiImplicitParam(name = "ids", value = "ids", required = true)
	@PostMapping("remove")
	public R remove(String ids)
	{		
		return toAjax(sysDealerInfoService.deleteSysDealerInfoByIds(ids));
	}
	
}
